﻿<ComboBox 
    x:Class="Imagin.Controls.Common.FontFamilyBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:l="http://wpflocalizeextension.codeplex.com"
    xmlns:local="clr-namespace:Imagin.Controls.Common"
    mc:Ignorable="d" 
    VerticalAlignment="Center" 
    SelectedIndex="0" 
    ItemsSource="{Binding Source={x:Static Fonts.SystemFontFamilies}}" 
    ToolTip="{l:Loc Font}">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock 
                x:Name="PART_Text"
                Text="{Binding Mode=OneWay}"/>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding ShowPreview, RelativeSource={RelativeSource AncestorType={x:Type local:FontFamilyBox}}}" Value="True">
                    <Setter TargetName="PART_Text" Property="FontFamily" Value="{Binding Mode=OneWay}"/>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>
